﻿@inherits System.Web.Mvc.WebViewPage

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>@View.Title</title>
	<script src="@Url.Content("~/Scripts/jquery-1.4.1.js")" type="text/javascript"></script>
	
	<link href="@Url.Content("~/Content/content.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/template.css")" rel="stylesheet" type="text/css" />
</head>
<body>
	<div class="page">

		<div class="head">
			<h2>Head</h2>
		</div>

		<div class="body">
			<div class="leftCol">
				<h2>Left Column</h2>
				<ul>
					<li>@Html.ActionLink("Home", "Index", "Home")</li>
				</ul>
			</div>

			<div class="rightCol">
			</div>

			<div class="main">
				@RenderBody()
			</div>
		</div>

		<div class="foot">
			<h2>Css code used to render this page</h2>
			<pre id="css" class="textcode"></pre>
		</div>
	</div>
	<script type="text/javascript">
	
		$(document).ready(function() {

			// display rendered css code in footer of page
			$("link[rel*='stylesheet']").each(function(i)
			{
					var foo = '<h2>' + this.getAttribute('href') + '</h2>';
					$(document).load(this.getAttribute('href'), function(response, status, xhr) {
						if (status == "error") {
							var msg = "Sorry but there was an error: ";
							$("#css").html(msg + xhr.status + " " + xhr.statusText);
						} else {
							$("#css").append(foo);
							$("#css").append(response);
						}
					});
			});

			// format the css code
			$(".csscode.formatted").each(function() {

				var code = $(this).text();
		
				code = code.replace(/([^{\s].*?):(.*?)(;|})/g, "<span style=color:red>$1</span>:<span style=color:blue>$2</span>;");
				code = code.replace(/(\/\*(.|\s)*?\*\/)/g, "<span style=color:green>$1</span>");
				code = code.replace(/(.*?){/g, "<span style=color:#800000>$1</span>{");

				$(this).html(code);
			});

		});



	</script>

</body>
</html>